#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll rr() {
    ll s = 0, w = false, c = getchar();
    for (; !isdigit(c); c = getchar())
        w = w || c == '-';
    for (; isdigit(c); c = getchar())
        s = s * 10 + c - '0';
    return w ? -s : s;
}

// END OF HEADER

int main() {
    int n = rr(), m = rr();
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        v[i] = rr();
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n - i - 1; j++) {
            if (v[j] > v[j + 1]) {
                swap(v[j], v[j + 1]);
            }
        }
    }
    printf("%d", v[0]);
    for (int i = 1; i < n; i++) {
        printf(" %d", v[i]);
    }
}
